﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace A6
{
    public partial class Form2: Form
    {
        private readonly OrderService orderService;
        public Form2(OrderService _orderService)
        {
            InitializeComponent();
            orderService = _orderService;
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("订单添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            // 带确认的对话框
            int ID = Int32.Parse(textBox1.Text);
            string goods = textBox2.Text;
            double money = double.Parse(textBox3.Text);
            string guest = textBox4.Text;
            orderService.AddOrder(new Order(new OrderDetails(ID, goods, money, guest)));
            Close();
        }
    }
}
